package com.hcb.tonguetiphealth.global;

import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.text.Spanned;
import android.widget.LinearLayout;

import com.hcb.tonguetiphealth.model.Cate;
import com.hcb.tonguetiphealth.model.Comment;
import com.hcb.tonguetiphealth.model.Drinks;
import com.hcb.tonguetiphealth.model.HealthCate;
import com.hcb.tonguetiphealth.model.ResDish;
import com.hcb.tonguetiphealth.model.Restaurant;
import com.hcb.tonguetiphealth.model.User;
import com.hcb.tonguetiphealth.view.ChatActivity;
import com.hcb.tonguetiphealth.view.HomeActivity;
import com.hcb.tonguetiphealth.widget.homepage.HomepageChatWidget2;

public class Global {

	public static final boolean DEBUG = true;
	public static User user, currentChatUser;
	public static boolean running = true;
	public static final Intent serviceIntent = new Intent("com.hcb.tonguetiphealth.service.TongueTipHealthService");
	public static final Intent serviceLiuYanIntent = new Intent("com.hcb.tonguetiphealth.service.TongueTipHealthServiceLiuYan");
	public static final String URL = "http://www.5xle.com.cn/jk/";
	public final static String defaultCityId = "129";//默认合肥的城市id
	public final static String CITYID = "cityId";
	public final static String USERNAME = "username";
	public final static String PASSWORD = "password";
	public static HomeActivity homeActivity;
	public static LinearLayout parentLinearLayout;
	public static HomepageChatWidget2 homepageChatWidget2;
	public static ChatActivity[] chatActivity = new ChatActivity[2];
	public static List<User> memberList;   //我的好友列表
	public static boolean isReceivingChat = false;  //是否已开启接收消息线程
	public static String lat;//纬度
	public static String lng;//经度
	/**
	 * 退出个人中心时的清理工作
	 */
	public static void clear() {
	//  Global.user = null;
		Global.currentChatUser = null;
		isReceivingChat = false;
		if(Global.memberList != null) {
			Global.memberList.clear();
			Global.memberList = null;
		}
		if(homepageChatWidget2 != null) {
			homepageChatWidget2 = null;
		}
		if(drinksList != null) {
			drinksList = null;
		}
		if(cateList != null) {
			cateList = null;
		}
		if(commentList != null) {
			commentList = null;
		}
		if(resList != null) {
			resList = null;
		}
		if(resDishList != null) {
			resDishList = null;
		}
		if(cartList != null) {
			cartList.clear();
		}
		if(recentResList != null) {
			recentResList.clear();
		}
		if(resDishOrderList != null) {
			resDishOrderList.clear();
		}
		
		if(DEBUG) {
			System.out.println("******************** 退出个人中心时的清理工作");
		}
	}
	
	/**
	 * 快速搜索
	 */
	public final static String  searchResUrl = "http://www.5xle.com.cn/jk/restaurantBook/searchRes.php";
	/**
	 * 热门商家、热门套餐
	 */
	private static final String servlet_hot_res = "restaurantBook/hotRes.php";
	/**
	 *美食分类
	 */
	private static final String servletFoodType = "restaurantBook/foodListType.php";
	
	/**
	 *商家详细
	 */
	private static final String servletResInfo = "restaurantBook/resInfo.php";
	
	/**
	 *发送商家地址到手机
	 */
	private static final String servletResSendMsg = "restaurantBook/sendMessage.php";
	
	/**
	 *发送参与短信到手机
	 */
	private static final String servletActivitySendMsg = "/cityWide/activitySendMessage.php";
	
	
	
	/**
	 *菜品列表
	 */
	private static final String servletResDishs = "restaurantBook/dishs.php";
	
	/**
	 *菜品详情
	 */
	private static final String servletResDishInfo = "ResBook/dishInfo.php";

	/**
	 *菜品订单
	 */
	private static final String servletDishOrder = "ResBook/dishOrder.php";
	
	/**
	 *健康达人
	 */
	private static final String servletHealthPeople = "homepage/healthPeople.php";
	//达人关注
	private static final String servletAttentoin = "/homepage/AttentionMember.php";
	/**
	 *会员搜索
	 */
	private static final String servletSearchMember = "homepage/memberSearch.php";
	
	/**
	 *热门搜索（会员） 
	 */
	private static final String servletHotMember = "homepage/hotMember.php";
	/**
	 *会员粉丝、关注
	 */
	private static final String servletFansAttention = "/homepage/memberFansAttenttion.php";
	/**
	 *健康传递
	 */
	private static final String servletHealtShare = "/healthShare/healthShareList.php";
	
	//健康传递查询
	private static final String servletHealthShareSearch = "/healthShare/healthShareInfoSearch.php"; 
		
		
	/**
	 *健康传递(用户id)
	 */
	private static final String servletHealtShareById = "/healthShare/healthShareListByUser.php";
	/**
	 *健康传递评论内容
	 */
	private static final String servletHealthComment = "/healthShare/healthShareInfo.php";
	/**
	 *健康传递评论提交
	 */
	private static final String servletHealthCommit = "/healthShare/healthShareCommit.php";
	/**
	 *健康传递鲜花+1 
	 */
	private static final String servletFlowerCommit = "/healthShare/healthShareCommitFlower.php";
	
	/**
	 * 检查apk版本信息
	 */
	private static final String servletCheckVersion = "/down/filename.php";
	
	/**
	 * 下载apk 压缩包的URl地址
	 */
	private static final String servletDownApk = "http://www.5xle.com.cn/down.php";
	
	//意见反馈接口
	private static final String servletAdvice = "/more/advice.php";
	//头像上传
	private static final String servletHeadportrait = "/homepage/headPortraitUpload.php"; 
   // 活动上传
	private static final String servletActivityCommit = "/cityWide/activityCommit.php";
	//获取活动
	private static final String servletActivitys = "/cityWide/activityList.php";
	//提交参与
	private static final String servletPeopleNum ="/cityWide/activityPeople.php";
	//健康传递
	private static final String servletMsgCommit = "/homepage/messsgaeCommit.php";
	/**
	 * 酒水列表
	 */
	public static final String servlet_wines = "wineBook/wines.php";
	/**
	 * 酒水品牌列表
	 */
	public static final String servlet_wineBrands = "wineBook/wineBrands.php";
	/**
	 * 酒水类型列表
	 */
	public static final String servlet_wineTypes = "wineBook/wineTypes.php";
	/**
	 * 酒水价格列表
	 */
	public static final String servlet_winePrice = "wineBook/winePrice.php";
	/**
	 * 酒水详情
	 */
	public static final String servlet_wineInfo = "wineBook/wineInfo.php";
	/**
	 * 酒水点评详情
	 */
	public static final String servlet_commentInfo = "general/commentInfo.php";
	/**
	 * 酒水点评
	 */
	public static final String servlet_comment = "general/comment.php";
	/**
	 * 酒水购买
	 */
	public static final String servlet_wineBuy = "wineBook/wineBuy.php";
	/**
	 * 舌尖健康酒水列表
	 */
	public static final String servlet_recommendWines = "recommendHealth/recommendWines.php";
	/**
	 * 舌尖健康美食楼列表
	 */
	public static final String servlet_recommendRes = "recommendHealth/recommendRes.php";
	/**
	 * 舌尖健康美食列表
	 */
	public static final String servlet_recommendDish = "recommendHealth/recommendDish.php";
	/**
	 * 舌尖健康套餐列表
	 */
	public static final String servlet_recommendCate = "recommendHealth/recommendCate.php";
	/** 舌尖健康营养套餐列表 */
	public static final String servlet_HealthCate = "recommendHealth/healthCate.php";
	/** 营养推荐评价 */
	public static final String servlet_healthCateComment = "recommendHealth/healthCateComment.php";
	/** 营养推荐评价列表 */
	public static final String servlet_getHealthCateComments = "recommendHealth/getHealthCateComments.php";
	/** 发送营养推荐详情到手机 */
	public static final String servlet_healthCateMessage = "recommendHealth/healthCateMessage.php";
	/**
	 * 舌尖健康套餐详情
	 */
	public static final String servlet_recommendCateInfo = "recommendHealth/recommendCateInfo.php";
	/**
	 * 舌尖健康套餐 发送地址到手机
	 */
	public static final String servlet_recommendCateMsgPhone = "recommendHealth/recommendCateMsgPhone.php";
	/**
	 * 舌尖健康套餐订购
	 */
	public static final String servlet_recommendCateBuy = "recommendHealth/recommendCateBuy.php";
// 用户信息查询
	public static final String servlet_userInfo = "homepage/userInfo.php";
	
	
	
	public static final String servletLogin = "homepage/login.php";
	public static final String servletLoginOut = "homepage/loginOut.php";
	public static final String servlet_register = "homepage/register.php"; //用户注册
	public static final String servlet_editinfo = "homepage/editInfo.php"; //用户资料修改
	public static final String servlet_watchedRes = "homepage/watchedRes.php"; //关注的商户列表
	public static final String servlet_ordered = "homepage/ordered.php"; //我的订单列表
	public static final String servlet_orderedInfo = "homepage/orderedInfo.php"; //我的订单列表详情
	public static final String servlet_friendsTrends = "homepage/friendsTrends.php"; //我的享友动态列表
	public static final String servlet_requestChat = "homepage/requestChat.php"; //向指定人请求聊天
	public static final String servlet_checkChat = "homepage/checkChat.php"; //查看是否有人向我请求聊天
	public static final String servlet_sendMsg = "homepage/sendMsg.php"; //向服务端发送消息
	public static final String servlet_receiveMsg = "homepage/receiveMsg.php";  //从服务端接收消息
	public static final String servlet_getMemberList = "homepage/getMemberList.php";  //获取好友列表
	public static final String servlet_refuseChat = "homepage/refuseChat.php";  //拒绝聊天
	public static final String servlet_acceptChat = "homepage/acceptChat.php";  //接受聊天
	public static final String servlet_resultChat = "homepage/resultChat.php";  //对方是否同意我的聊天请求
	public static final String servlet_chatLiuyan = "homepage/chatLiuyan.php";  //给好友留言
	public static final String servlet_receiveLiuyan = "homepage/receiveLiuyan.php";  //接收留言
	public static final String servlet_sendPicture = "homepage/sendPicture.php";  //发送图片
	public static final String servlet_healthRecommendCate = "homepage/healthRecommendCate.php";  //营养推荐
	
	public static List<HealthCate> healthCateList;
	public static List<Drinks> drinksList;
	public static List<Cate> cateList;
	public static List<Drinks> cartList = new ArrayList<Drinks>();
	public static List<Comment> commentList;
	public static List<Restaurant> resList;
	public static List<Restaurant> recentResList = new ArrayList<Restaurant>();
	public static List<ResDish> resDishList;
	public static List<ResDish> resDishOrderList = new ArrayList<ResDish>();
	
	public static Spanned sp;
	
	/**
	 * 热门商家、热门套餐url
	 */
	public static String getServletHotRes() {
		return URL + servlet_hot_res;
	}
	
	/**
	 * 美食分类url
	 */
	public static String getServletfoodtype() {
		return URL + servletFoodType;
	}
	/**
	 * 商家详细url
	 */
	public static String getServletResInfo() {
		return URL + servletResInfo;
	}
	/**
	 * 商家菜品url
	 */
	public static String getServletresdishs() {
		return URL + servletResDishs;
	}
	/**
	 * 发送商家地址到手机url
	 */
	public static String getServletressendmsg() {
		return URL + servletResSendMsg;
	}
	/**
	 * 商家菜品详情url
	 */
	public static String getServletresdishinfo() {
		return URL + servletResDishInfo;
	}
	
	/**
	 * 菜单预订
	 */
	public static String getServletDishOrder() {
		return URL + servletDishOrder;
	}

	/**
	 * 登录
	 */
	public static String getServletlogin() {
		return URL + servletLogin;
	}

	/**
	 * 健康达人列表
	 */
	public static String getServlethealthpeople() {
		return URL + servletHealthPeople;
	}

	/**
	 * 搜索会员
	 */
	public static String getServletsearchmemberURl() {
		return URL + servletSearchMember;
	}
	/**
	 * 热门会员
	 */
	public static String getServlethotmember() {
		return URL + servletHotMember;
	}
	/**
	 * 粉丝、关注
	 */
	public static String getServletfansattentionUrl() {
		return URL +  servletFansAttention;
	}
	/**
	 * 健康传递列表
	 */
	public static String getServlethealtshare() {
		return URL + servletHealtShare;
	}
	/**
	 * 健康传递列表（根据用户id）
	 */
	public static String getServlethealtsharebyid() {
		return URL + servletHealtShareById;
	}
	/**
	 * 健康传递评论列表
	 */
	public static String getServlethealthcomment() {
		return URL +  servletHealthComment;
	}
	/**
	 * 健康传递评论提交
	 */
	public static String getServlethealthcommit() {
		return URL + servletHealthCommit;
	}

	/**
	 * 健康传递鲜花+1
	 * @return
	 */
	public static String getServletflowercommit() {
		return URL + servletFlowerCommit;
	}

	/**
	 * 检查版本号
	 * @return
	 */
	public static String getServletcheckversion() {
		return URL + servletCheckVersion;
	}

	/**
	 * 下载apk
	 * @return
	 */
	public static String getServletdownapk() {
		return servletDownApk;
	}
	
	/**
	 * 意见反馈
	 * @return
	 */
	public static String getServletadvice() {
		return URL + servletAdvice;
	}
	/**
	 *头像上传url 
	 * @return
	 */
	public static String getServletheadportrait() {
		return URL + servletHeadportrait;
	}
 
	/**
	 *活动上传 
	 * @return
	 */
	public static String getServletactivitycommit() {
		return URL + servletActivityCommit;
	}
	/**
	 *获取活动 
	 * @return
	 */
	public static String getServletactivitys() {
		return URL + servletActivitys;
	}
	/**
	 * 提交参与
	 * @return
	 */
	public static String getServletpeoplenum() {
		return URL + servletPeopleNum;
	}
	/**
	 * 达人关注
	 * @return
	 */
	public static String getServletattentoin() {
		return URL + servletAttentoin;
	}
	/**
	 * 传递信息
	 */
	public static String getServletmsgcommit() {
		return URL + servletMsgCommit;
	}

	/**
	 * 发送短信给参与者 
	 * @return
	 */
	public static String getServletactivitysendmsg() {
		return URL + servletActivitySendMsg;
	}
   
	/**
	 * 返回用户信息
	 * @return
	 */
	public static String getServletUserinfo() {
		return URL  + servlet_userInfo;
	}

	/**
	 * 查询健康传递信息
	 * @return
	 */
	public static String getServlethealthsharesearch() {
		return URL + servletHealthShareSearch;
	}
	 
	
	
}
